home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- ** CMUI_HGroup class definition
- ***************************************************************************/
-
- class CMUI_HGroup : public CMUI_Group
- {
- public:
-
- CMUI_HGroup (void)
- : CMUI_Group ()
- {
- object = NULL;
- }
-
- CMUI_HGroup (Tag tag1, ...)
- : CMUI_Group (MUIA_Group_Horiz, TRUE,
- TAG_MORE, (Tag)&tag1)
- {
- }
-
- CMUI_HGroup (Object * obj)
- : CMUI_Group ()
- {
- object = obj;
- }
- };
-
- inline CMUI_String::operator const char * ()
- {
- return (const char *)Contents ();
- }
-
- inline CMUI_String::operator ULONG ()
- {
- return Integer ();
- }
-
- inline CMUI_String & CMUI_String::operator = (const char *contents)
- {
- SetContents ((STRPTR)contents);
- return *this;
- }
-
- inline CMUI_String & CMUI_String::operator = (ULONG contents)
- {
- SetInteger (contents);
- return *this;
- }
-
- inline CMUI_Text::operator const char * ()
- {
- return (const char *)Contents ();
- }
-
- inline CMUI_Text & CMUI_Text::operator = (const char *contents)
- {
- SetContents ((STRPTR)contents);
- return *this;
- }
-
- inline CMUI_Numeric::operator LONG ()
- {
- return Value ();
- }
-
- inline CMUI_Numeric::operator int ()
- {
- return (int)Value ();
- }
-
- inline CMUI_Numeric & CMUI_Numeric::operator = (LONG value)
- {
- SetValue (value);
- return *this;
- }
-
- inline CMUI_Numeric & CMUI_Numeric::operator = (int value)
- {
- SetValue ((LONG)value);
- return *this;
- }
-
- inline CMUI_Numeric CMUI_Numeric::operator ++ () // prefix
- {
- Increase (1);
- return *this;
- }
-
- inline CMUI_Numeric CMUI_Numeric::operator ++ (int dummy) // postfix
- {
- Increase (1);
- return *this;
- }
-
- inline CMUI_Numeric & CMUI_Numeric::operator += (LONG value)
- {
- Increase (value);
- return *this;
- }
-
- inline CMUI_Numeric CMUI_Numeric::operator -- () // prefix
- {
- Decrease (1);
- return *this;
- }
-
- inline CMUI_Numeric CMUI_Numeric::operator -- (int dummy) // postfix
- {
- Decrease (1);
- return *this;
- }
-
- inline CMUI_Numeric & CMUI_Numeric::operator -= (LONG value)
- {
- Decrease (value);
- return *this;
- }
-
- #ifdef MUIPP_TEMPLATES
-
- /***************************************************************************
- ** CTMUI_List : Template version of CMUI_List class definition
- ***************************************************************************/
-
- template <class Type>
- class CTMUI_List : public CMUI_Area
- {
- public:
- CTMUI_List (void)
- : CMUI_Area ()
- {
- object = NULL;
- }
-
- CTMUI_List (Tag tag1, ...)
- : CMUI_Area ()
- {
- object = MUI_NewObjectA (MUIC_List, (struct TagItem *)&tag1);
- #ifdef MUIPP_DEBUG
- if (object == NULL)
- _MUIPPWarning ("Could not create a CTMUI_List object\n");
- #endif
- }
-
- CTMUI_List (Object * obj)
- : CMUI_Area ()
- {
- object = obj;
- }
-
- CTMUI_List & operator = (Object * obj)
- {
- object = obj;
- return *this;
- }
-
- // By overloading the [] operator you can treat lists like arrays
-
- Type & operator [] (LONG pos)
- {
- Type *entry;
- DoMethod (MUIM_List_GetEntry, pos, &entry);
-
- #ifdef MUIPP_DEBUG
- if (entry == NULL)
- _MUIPPError ("Index into CTMUI_List is out of range:\n"
- "Index = %ld, List length = %ld\n", pos, (LONG)Entries());
- #endif
- return *entry;
- }
-
- // This method is a convienient alternative to the Entries attribute
-
- LONG Length (void) const
- {
- return (LONG)GetAttr (MUIA_List_Entries);
- }
-
- // This method can be used to retrieve the number of selected entries
- // in a list
-
- ULONG NumSelected (void)
- {
- ULONG numSelected;
- DoMethod (MUIM_List_Select, MUIV_List_Select_All, MUIV_List_Select_Ask, &numSelected);
- return numSelected;
- }
-
- // These methods can be used as shortcuts for inserting objects into lists
-
- void InsertTop (Type *entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Top);
- }
-
- void InsertTop (Type &entry)
- {
- DoMethod (MUIM_List_InsertSingle, &entry, MUIV_List_Insert_Top);
- }
-
- void InsertBottom (Type *entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Bottom);
- }
-
- void InsertBottom (Type &entry)
- {
- DoMethod (MUIM_List_InsertSingle, &entry, MUIV_List_Insert_Bottom);
- }
-
- void InsertSorted (Type *entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Sorted);
- }
-
- void InsertSorted (Type &entry)
- {
- DoMethod (MUIM_List_InsertSingle, &entry, MUIV_List_Insert_Sorted);
- }
-
- void InsertActive (Type *entry)
- {
- DoMethod (MUIM_List_InsertSingle, entry, MUIV_List_Insert_Active);
- }
-
- void InsertActive (Type &entry)
- {
- DoMethod (MUIM_List_InsertSingle, &entry, MUIV_List_Insert_Active);
- }
-
- void InsertSingle (Type &entry, LONG pos)
- {
- DoMethod (MUIM_List_InsertSingle, &entry, pos);
- }
-
- LONG Active (void) const
- {
- return (LONG)GetAttr (MUIA_List_Active);
- }
-
- void SetActive (LONG value)
- {
- SetAttr (MUIA_List_Active, (ULONG)value);
- }
-
- BOOL AutoVisible (void) const
- {
- return (BOOL)GetAttr (MUIA_List_AutoVisible);
- }
-
- void SetAutoVisible (BOOL value)
- {
- SetAttr (MUIA_List_AutoVisible, (ULONG)value);
- }
-
- void SetCompareHook (struct Hook * value)
- {
- SetAttr (MUIA_List_CompareHook, (ULONG)value);
- }
-
- void SetConstructHook (struct Hook * value)
- {
- SetAttr (MUIA_List_ConstructHook, (ULONG)value);
- }
-
- void SetDestructHook (struct Hook * value)
- {
- SetAttr (MUIA_List_DestructHook, (ULONG)value);
- }
-
- void SetDisplayHook (struct Hook * value)
- {
- SetAttr (MUIA_List_DisplayHook, (ULONG)value);
- }
-
- BOOL DragSortable (void) const
- {
- return (BOOL)GetAttr (MUIA_List_DragSortable);
- }
-
- void SetDragSortable (BOOL value)
- {
- SetAttr (MUIA_List_DragSortable, (ULONG)value);
- }
-
- LONG DropMark (void) const
- {
- return (LONG)GetAttr (MUIA_List_DropMark);
- }
-
- LONG Entries (void) const
- {
- return (LONG)GetAttr (MUIA_List_Entries);
- }
-
- LONG First (void) const
- {
- return (LONG)GetAttr (MUIA_List_First);
- }
-
- STRPTR Format (void) const
- {
- return (STRPTR)GetAttr (MUIA_List_Format);
- }
-
- void SetFormat (STRPTR value)
- {
- SetAttr (MUIA_List_Format, (ULONG)value);
- }
-
- LONG InsertPosition (void) const
- {
- return (LONG)GetAttr (MUIA_List_InsertPosition);
- }
-
- void SetMultiTestHook (struct Hook * value)
- {
- SetAttr (MUIA_List_MultiTestHook, (ULONG)value);
- }
-
- void SetQuiet (BOOL value)
- {
- SetAttr (MUIA_List_Quiet, (ULONG)value);
- }
-
- BOOL ShowDropMarks (void) const
- {
- return (BOOL)GetAttr (MUIA_List_ShowDropMarks);
- }
-
- void SetShowDropMarks (BOOL value)
- {
- SetAttr (MUIA_List_ShowDropMarks, (ULONG)value);
- }
-
- char * Title (void) const
- {
- return (char *)GetAttr (MUIA_List_Title);
- }
-
- void SetTitle (char * value)
- {
- SetAttr (MUIA_List_Title, (ULONG)value);
- }
-
- LONG Visible (void) const
- {
- return (LONG)GetAttr (MUIA_List_Visible);
- }
-
- ULONG Clear (void)
- {
- return DoMethod (MUIM_List_Clear);
- }
-
- ULONG CreateImage (Object * obj, ULONG flags)
- {
- return DoMethod (MUIM_List_CreateImage, obj, flags);
- }
-
- ULONG DeleteImage (APTR listimg)
- {
- return DoMethod (MUIM_List_DeleteImage, listimg);
- }
-
- ULONG Exchange (LONG pos1, LONG pos2)
- {
- return DoMethod (MUIM_List_Exchange, pos1, pos2);
- }
-
- ULONG GetEntry (LONG pos, Type ** entry)
- {
- return DoMethod (MUIM_List_GetEntry, pos, entry);
- }
-
- ULONG Insert (Type ** entries, LONG count, LONG pos)
- {
- return DoMethod (MUIM_List_Insert, entries, count, pos);
- }
-
- ULONG InsertSingle (Type * entry, LONG pos)
- {
- return DoMethod (MUIM_List_InsertSingle, entry, pos);
- }
-
- ULONG Jump (LONG pos)
- {
- return DoMethod (MUIM_List_Jump, pos);
- }
-
- ULONG Move (LONG from, LONG to)
- {
- return DoMethod (MUIM_List_Move, from, to);
- }
-
- ULONG NextSelected (LONG * pos)
- {
- return DoMethod (MUIM_List_NextSelected, pos);
- }
-
- ULONG Redraw (LONG pos)
- {
- return DoMethod (MUIM_List_Redraw, pos);
- }
-
- ULONG Remove (LONG pos)
- {
- return DoMethod (MUIM_List_Remove, pos);
- }
-
- ULONG Select (LONG pos, LONG seltype, LONG * state)
- {
- return DoMethod (MUIM_List_Select, pos, seltype, state);
- }
-
- ULONG Sort (void)
- {
- return DoMethod (MUIM_List_Sort);
- }
-
- ULONG TestPos (LONG x, LONG y, struct MUI_List_TestPos_Result * res)
- {
- return DoMethod (MUIM_List_TestPos, x, y, res);
- }
- };
-
-
-
- /***************************************************************************
- ** CTMUI_Listview : Template version of CMUI_Listview class definition
- ***************************************************************************/
-
- template <class Type>
- class CTMUI_Listview : public CTMUI_List<Type>
- {
- public:
- CTMUI_Listview (void)
- : CTMUI_List<Type> ()
- {
- object = NULL;
- }
-
- CTMUI_Listview (Tag tag1, ...)
- : CTMUI_List<Type> ()
- {
- #ifdef MUIPP_DEBUG
- _CheckTagsSpecified ("CTMUI_Listview", (struct TagItem *)&tag1, MUIA_Listview_List, "MUIA_Listview_List", TAG_DONE);
- #endif
- object = MUI_NewObjectA (MUIC_Listview, (struct TagItem *)&tag1);
- #ifdef MUIPP_DEBUG
- if (object == NULL)
- _MUIPPWarning ("Could not create a CTMUI_Listview object\n");
- #endif
- }
-
- CTMUI_Listview (Object * obj)
- : CTMUI_List<Type> ()
- {
- object = obj;
- }
-
- CTMUI_Listview & operator = (Object * obj)
- {
- object = obj;
- return *this;
- }
-
- LONG ActivePage (void) const
- {
- return (LONG)GetAttr (MUIA_Group_ActivePage);
- }
-
- void SetActivePage (LONG value)
- {
- SetAttr (MUIA_Group_ActivePage, (ULONG)value);
- }
-
- struct List * ChildList (void) const
- {
- return (struct List *)GetAttr (MUIA_Group_ChildList);
- }
-
- void SetColumns (LONG value)
- {
- SetAttr (MUIA_Group_Columns, (ULONG)value);
- }
-
- LONG HorizSpacing (void) const
- {
- return (LONG)GetAttr (MUIA_Group_HorizSpacing);
- }
-
- void SetHorizSpacing (LONG value)
- {
- SetAttr (MUIA_Group_HorizSpacing, (ULONG)value);
- }
-
- void SetRows (LONG value)
- {
- SetAttr (MUIA_Group_Rows, (ULONG)value);
- }
-
- void SetSpacing (LONG value)
- {
- SetAttr (MUIA_Group_Spacing, (ULONG)value);
- }
-
- LONG VertSpacing (void) const
- {
- return (LONG)GetAttr (MUIA_Group_VertSpacing);
- }
-
- void SetVertSpacing (LONG value)
- {
- SetAttr (MUIA_Group_VertSpacing, (ULONG)value);
- }
-
- ULONG ExitChange (void)
- {
- return DoMethod (MUIM_Group_ExitChange);
- }
-
- ULONG InitChange (void)
- {
- return DoMethod (MUIM_Group_InitChange);
- }
-
- ULONG Sort (StartVarArgs sva, Object * obj, ...)
- {
- sva.methodID = MUIM_Group_Sort;
- return DoMethodA ((Msg)&sva);
- }
-
- LONG ClickColumn (void) const
- {
- return (LONG)GetAttr (MUIA_Listview_ClickColumn);
- }
-
- LONG DefClickColumn (void) const
- {
- return (LONG)GetAttr (MUIA_Listview_DefClickColumn);
- }
-
- void SetDefClickColumn (LONG value)
- {
- SetAttr (MUIA_Listview_DefClickColumn, (ULONG)value);
- }
-
- BOOL DoubleClick (void) const
- {
- return (BOOL)GetAttr (MUIA_Listview_DoubleClick);
- }
-
- LONG DragType (void) const
- {
- return (LONG)GetAttr (MUIA_Listview_DragType);
- }
-
- void SetDragType (LONG value)
- {
- SetAttr (MUIA_Listview_DragType, (ULONG)value);
- }
-
- Object * List (void) const
- {
- return (Object *)GetAttr (MUIA_Listview_List);
- }
-
- BOOL SelectChange (void) const
- {
- return (BOOL)GetAttr (MUIA_Listview_SelectChange);
- }
- };
-
-
- #endif /* MUIPP_TEMPLATES */
-
- #endif /* LIBRARIES_MUI_HPP */